<?php

header("Content-Type: text/x-csv");
header("Content-Disposition: attachment; filename=export.csv");

echo "\"" . implode("\",\"", $headers->getRawValue()) . "\"" . PHP_EOL;

foreach ($rows as $row) {
    
    echo "\"" . implode("\",\"", $row->getRawValue()) . "\"" . PHP_EOL;
}
